﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;

namespace TrinityEngine.Tilemap
{
    public class Tilemap : Renderer
    {
        public float cellSize;

        public Sprite atlas;

        public List<TileData> mapData;

        public Tilemap(Sprite atlas, List<TileData> mapData)
        {
            this.atlas = atlas;
            cellSize = 1f;
            this.mapData = mapData;
        }

        protected override void Render()
        {
            /*foreach (var data in mapData)
            {
                int count = atlas.texture.Width / atlas.pixelPerUnit;
                int x = data.cellIndex % count * atlas.pixelPerUnit;
                int y = data.cellIndex / count * atlas.pixelPerUnit;
                Rectangle sourceRectangle = new Rectangle(x, y, atlas.pixelPerUnit, atlas.pixelPerUnit);

                Engine.Instance.batch.Draw(
                atlas.texture,
                new Vector2(data.position.X, -data.position.Y) * _scale + new Vector2(_position.x, -_position.y),
                sourceRectangle,
                tint,
                0,
                Vector2.One * atlas.pixelPerUnit * 0.5f,
                _scale / atlas.pixelPerUnit,
                SpriteEffects.None,
                sortingLayer);
            }*/
        }
    }
}
